﻿using Infrastructure;
using Launcher.ViewModels;
using Microsoft.Practices.Unity;

using System;
using System.Windows;

namespace Launcher.Modules
{
    class StartModule : ModuleBase
    {
        public override void LoadCommonStyle()
        {
            ResourceDictionary item = new ResourceDictionary { Source = new Uri(@"/DataTemplates/DataTemplate.xaml", UriKind.Relative) };
            Application.Current.Resources.MergedDictionaries.Add(item);
        }

        public override void Substrict()
        {
            EventAggregator.GetEvent<StartEvent>().Subscribe(OnStartEvent, true);
        }

        public void OnStartEvent(object payload)
        {
            StartViewModel vm = UnityContainer.Resolve<StartViewModel>();
            vm.Initalize();
        }
    }
}
